import { ref, computed } from "vue";
import { defineStore } from "pinia";

export const useUserStore = defineStore(
  "user",
  () => {
    const userInfo = ref({});
    const isLogin = ref(false);
    const token = ref("");
    const currentType = ref();
    const searchKey = ref("");

    return { userInfo, isLogin, token, currentType, searchKey };
  },
  {
    persist: {
      enabled: true,
      strategies: [
        {
          key: "user",
          storage: localStorage,
        },
      ],
    },
  }
);
